package team.sun.sss.dao.user;


import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import team.sun.sss.pojo.user.User;

import java.util.List;

@Mapper
@Repository
public interface UserDao {

    @Select("select * from user")
    List<User> userList();

    @Insert("insert into user(user_id,user_pwd,user_type,user_state) values(#{userId},#{userPwd},#{userType},#{userState})")
    int addUser(User user);

    @Select("select * from user where user_id=#{userId} and user_pwd=#{userPwd}")
    User selectUserByIdAndPwd(int userId,String userPwd);

    @Update("update user set user_state = 1 where user_id=#{userId}")
    int userStop(String userId);

    @Update("update user set user_state = 0 where user_id=#{userId}")
    int userStart(String userId);

    @Update("update user set user_pwd = #{userPwd} where user_id=#{userId}")
    int updatePwd(int userId,String userPwd);
}
